<?php
	/* Function for page layout */

	require_once("config.php");
	if(isset($_SESSION['lang'])) {
		require_once("include/lang." . $_SESSION['lang'] . ".php");
	}
	else {
		require_once("include/lang." . LANG . ".php");
	}

	function html_start() {
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
	<head>
		<title>XaBook</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta name="author" content="Martin Mortensen" />
		<meta name="title" content="AddressBook v.0.1 alpha" />
		<meta name="keywords" content="addressbook, address, book, opensource" />
		<link rel="stylesheet" href="css/layout.css" media="all" type="text/css" />
		<script type="text/javascript" src="js/res.js"></script>
 
<script type="text/javascript" language="javascript">
    	var spamCall = function(callback)
    	{
    		callback(true);
    	}
    </script>

    <script type="text/javascript" language="javascript" src="ijab_config.js"></script>
    <script type="text/javascript" language="javascript" src="ijab_i18n_pt.js"></script>
    <script type="text/javascript" language="javascript" src="ijab/ijab.nocache.js"></script>

<script type="text/javascript">
    	var loginiJab = function()
    	{
    	var userName = document.getElementById("uname").value;
    	var password = document.getElementById("pword").value;
    	if(userName == ""||password=="")
    	{
    		alert("username or password is empty!");
    	};
    	var handler = 
		{
			onBeforeLogin:function()
			{
				alert("On Before login");
			},
			onEndLogin:function()
			{
				alert("On end login");
			},
			onError:function(message)
			{
				iJab.login('test','test');
			},
			onLogout:function()
			{
				alert("On logout");
			},
			onResume:function()
			{
				alert("On resume");
			},
			onSuspend:function()
			{
				alert("On suspend")
			},
			onAvatarClicked:function(x,y,username,jid)
			{
				alert("onAvatarClicked posX:"+x+" posY:"+y+" username:"+username+" jid:"+jid)
			},
			onAvatarMouseOver:function(x,y,username,jid)
			{
				alert("onAvatarMouseOver posX:"+x+" posY:"+y+" username:"+username+" jid:"+jid)
			},
			 onStatusTextUpdated:function(text)
			 {
			 	alert(" onStatusTextUpdated:+"+text);
			 }
		};
    	iJab.login(userName,password);
    	}
    </script>
	</head>
	<body>
<iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe>

		<div id="top">
		</div>
		<div id="top2">
		<div id="ver">&nbsp;Ecosystems - Communication Dashboard</div>
		</div>


			<div id="menu">
				<div id="nav">
					<span class="conin">
						<?php
							if($_SESSION['login'] == 1 && $_SESSION['sessionid'] == session_id()) {
								print "<img src=\"img/head.gif\" alt=\"\" /> " . $_SESSION['user'] . "<br />\n";
								print "<ul class=\"sidemenu\" />\n";
								if($_SESSION['priv'] >= 1) {
									print "<li><a href=\"home.php\">" . MENU_CONTACTS . "</a></li><br />\n";
								}
								if($_SESSION['priv'] >= 2) {
									print "<li><a href=\"contact.php\">" . MENU_ADD . "</a></li><br />\n";
									print "<li><a href=\"phoneralternate.php\">" ."Make Call". "</a></li><br />\n";
									print "<li><a href=\"smseralternate.php\">" ."Send SMS". "</a></li><br />\n";
									print "<li><a href=\"importcontact.php\">" ."Import contacts". "</a></li><br />\n";

								}
								if($_SESSION['priv'] == 3) {
									print "<li><a href=\"groups.php\">" . MENU_GROUPS . "</a></li><br />\n";
									print "<li><a href=\"users.php\">" . MENU_USERS . "</a></li><br />\n";
								}
								print "<li><a href=\"logout.php\" onClick=\"iJab.logout();\">" . MENU_LOGOUT . "</a></li>\n";

									
							}
							else {
								print LANG_WELCOME;
							}
							print "</ul />\n"
						?>
					</span>
				</div>
			</div>

		<div id="content">
<?php
	}

	function html_end() {
?>
		</div>
		<div id="bottom">
		<div id="ver2">&nbsp;Design & development - <a href="http://www.mgo.pt" target="_new">www.mgo.pt</a>
		</div>
		</div>

	</body>
</html>
<?php
	}
?>
